/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @signatureAlgorithm = 'v2';
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('appstream-center', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model GetConnectionTicketRequest {
  accessType?: string(name='AccessType', example='INTERNET', nullable=true),
  appId?: string(name='AppId', example='ca-etn4zizgaezo9gis9'),
  appInstanceGroupId?: string(name='AppInstanceGroupId', example='aig-bw1o1gcwvd3e1ipeu'),
  appInstanceId?: string(name='AppInstanceId'),
  appVersion?: string(name='AppVersion', example='1.0.0.1'),
  autoConnectInQueue?: boolean(name='AutoConnectInQueue'),
  bizRegionId?: string(name='BizRegionId', example='cn-hangzhou'),
  clientId?: string(name='ClientId', example='f2463208-ec89-4309-8e8c-8b17acdcab93'),
  clientIp?: string(name='ClientIp', example='22.21.2.21'),
  clientOS?: string(name='ClientOS', example='windows_"Windows 10 Enterprise LTSC 2019" 10.0 (Build 17763)'),
  clientType?: string(name='ClientType'),
  clientVersion?: string(name='ClientVersion', example='2.0.1-D-20211008.101607'),
  connectionProperties?: string(name='ConnectionProperties'),
  endUserId?: string(name='EndUserId', example='test.test'),
  environmentConfig?: string(name='EnvironmentConfig'),
  loginRegionId?: string(name='LoginRegionId', example='cn-hangzhou'),
  loginToken?: string(name='LoginToken', example='v1c4e2ef03d620f0f6cb41634196161219054e12d8aa5a13deb9ed14eebb76d674559115ad2e27a57f6820c1fd33e0ca36'),
  param?: string(name='Param', example='/home/test/test.jpg'),
  productType?: string(name='ProductType', description='This parameter is required.', example='CloudApp'),
  resourceId?: string(name='ResourceId'),
  sessionId?: string(name='SessionId', example='09e2b2e6-3181-4c84-9539-6fc9f1c3199e'),
  taskId?: string(name='TaskId', example='6f41731b-7091-4954-80c8-1d1e0b3ebb48'),
  tenantId?: string(name='TenantId', example='1126819517152528'),
  uuid?: string(name='Uuid', example='A8B35215993FBF283F28D617975204C4'),
}

model GetConnectionTicketResponseBody = {
  appInstanceGroupId?: string(name='AppInstanceGroupId', example='aig-53fvrq1oanz6cxzi3'),
  appInstanceId?: string(name='AppInstanceId', example='ai-gc1gemx6vpa6vlync'),
  appInstancePersistentId?: string(name='AppInstancePersistentId'),
  bindQueueInfo?: {
    queueStatus?: string(name='QueueStatus'),
    rank?: int32(name='Rank'),
    readyTimeout?: long(name='ReadyTimeout'),
    remainingTime?: long(name='RemainingTime'),
    requestKey?: string(name='RequestKey'),
    targetId?: string(name='TargetId'),
    waitTime?: long(name='WaitTime'),
  }(name='BindQueueInfo'),
  code?: string(name='Code', example='InternalError.TicketGenInternalError'),
  loginToken?: string(name='LoginToken', example='v15418e331d8d068c29411646996786785303b8f61fd880aeaa50c5b584443cd9e65cc7eec72acdaad0a844666a3b26dab'),
  message?: string(name='Message', example='reenter app instance failed'),
  osType?: string(name='OsType', example='Windows'),
  policy?: {
    resolutionAdaptive?: string(name='ResolutionAdaptive'),
    resolutionHeight?: int32(name='ResolutionHeight'),
    resolutionWidth?: int32(name='ResolutionWidth'),
  }(name='Policy'),
  regionId?: string(name='RegionId', example='cn-hangzhou'),
  requestId?: string(name='RequestId', description='Id of the request', example='AD2D0761-1FE5-549D-B169-D3F8D19C6CDD'),
  retryTimes?: int32(name='RetryTimes', example='3'),
  taskId?: string(name='TaskId', example='f3d1b31c-605e-4d04-a896-015fc9fc03b4'),
  taskStatus?: string(name='TaskStatus', example='Running'),
  tenantId?: long(name='TenantId'),
  ticket?: string(name='Ticket', example='n7n9bqZlPrvgUOPSJzfdb$89jWwlVISgrchpY0tOfVYGBBcdoPoH39PVHK63fQTEM14kzajQdWAnHTnSicc35W_eI2LbTSGKquKukwcU7opRwmInhtQH*mlmsZQ3ByOLYVmqI*1hFESs0'),
}

model GetConnectionTicketResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetConnectionTicketResponseBody(name='body'),
}

/**
 * @summary 获取连接信息
 *
 * @param request GetConnectionTicketRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetConnectionTicketResponse
 */
async function getConnectionTicketWithOptions(request: GetConnectionTicketRequest, runtime: Util.RuntimeOptions): GetConnectionTicketResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accessType)) {
    body['AccessType'] = request.accessType;
  }
  if (!Util.isUnset(request.appId)) {
    body['AppId'] = request.appId;
  }
  if (!Util.isUnset(request.appInstanceGroupId)) {
    body['AppInstanceGroupId'] = request.appInstanceGroupId;
  }
  if (!Util.isUnset(request.appInstanceId)) {
    body['AppInstanceId'] = request.appInstanceId;
  }
  if (!Util.isUnset(request.appVersion)) {
    body['AppVersion'] = request.appVersion;
  }
  if (!Util.isUnset(request.autoConnectInQueue)) {
    body['AutoConnectInQueue'] = request.autoConnectInQueue;
  }
  if (!Util.isUnset(request.bizRegionId)) {
    body['BizRegionId'] = request.bizRegionId;
  }
  if (!Util.isUnset(request.clientId)) {
    body['ClientId'] = request.clientId;
  }
  if (!Util.isUnset(request.clientIp)) {
    body['ClientIp'] = request.clientIp;
  }
  if (!Util.isUnset(request.clientOS)) {
    body['ClientOS'] = request.clientOS;
  }
  if (!Util.isUnset(request.clientType)) {
    body['ClientType'] = request.clientType;
  }
  if (!Util.isUnset(request.clientVersion)) {
    body['ClientVersion'] = request.clientVersion;
  }
  if (!Util.isUnset(request.connectionProperties)) {
    body['ConnectionProperties'] = request.connectionProperties;
  }
  if (!Util.isUnset(request.endUserId)) {
    body['EndUserId'] = request.endUserId;
  }
  if (!Util.isUnset(request.environmentConfig)) {
    body['EnvironmentConfig'] = request.environmentConfig;
  }
  if (!Util.isUnset(request.loginRegionId)) {
    body['LoginRegionId'] = request.loginRegionId;
  }
  if (!Util.isUnset(request.loginToken)) {
    body['LoginToken'] = request.loginToken;
  }
  if (!Util.isUnset(request.param)) {
    body['Param'] = request.param;
  }
  if (!Util.isUnset(request.productType)) {
    body['ProductType'] = request.productType;
  }
  if (!Util.isUnset(request.resourceId)) {
    body['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.sessionId)) {
    body['SessionId'] = request.sessionId;
  }
  if (!Util.isUnset(request.taskId)) {
    body['TaskId'] = request.taskId;
  }
  if (!Util.isUnset(request.tenantId)) {
    body['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.uuid)) {
    body['Uuid'] = request.uuid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetConnectionTicket',
    version = '2021-09-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'Anonymous',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取连接信息
 *
 * @param request GetConnectionTicketRequest
 * @return GetConnectionTicketResponse
 */
async function getConnectionTicket(request: GetConnectionTicketRequest): GetConnectionTicketResponse {
  var runtime = new Util.RuntimeOptions{};
  return getConnectionTicketWithOptions(request, runtime);
}

model ListPublishedAppInfoRequest {
  appName?: string(name='AppName', example='Microsoft Word'),
  bizRegionId?: string(name='BizRegionId', example='cn-hangzhou'),
  categoryId?: long(name='CategoryId', example='1'),
  categoryType?: long(name='CategoryType', example='1'),
  clientId?: string(name='ClientId', example='17b38aaa-761f-44c5-9862-2ad0f5025d15'),
  clientIp?: string(name='ClientIp', example='125.80.132.13'),
  clientOS?: string(name='ClientOS', example='windows_\\\\"Windows 10 Enterprise\\\\" 10.0 (Build 14393)'),
  clientVersion?: string(name='ClientVersion', example='2.0.1-D-20211008.101607'),
  endUserId?: string(name='EndUserId', example='test.test'),
  loginRegionId?: string(name='LoginRegionId', example='cn-shanghai'),
  loginToken?: string(name='LoginToken', example='v189fa78c1aff77a0483b16497517322299131027b85bb84bbdc0871988ce8296d8fd891e2fdeaded3bd75f81f639acee8'),
  orderParam?: string(name='OrderParam'),
  productType?: string(name='ProductType', example='CloudApp'),
  sessionId?: string(name='SessionId', example='c261a6a1-e242-4f4b-813c-5fe807e49f03'),
  sortType?: string(name='SortType'),
}

model ListPublishedAppInfoResponseBody = {
  appModels?: [ 
    {
      appCenterImageId?: string(name='AppCenterImageId', example='img-f37nddbjc1lje14st'),
      appId?: string(name='AppId', example='ca-fxwp4koyr5y2sp4mz'),
      appName?: string(name='AppName', example='Microsoft Word'),
      appThemeColor?: string(name='AppThemeColor'),
      appVersion?: string(name='AppVersion', example='R2021a'),
      appVersionName?: string(name='AppVersionName', example='v1.0'),
      authTime?: string(name='AuthTime'),
      categoryId?: long(name='CategoryId', example='2'),
      categoryType?: long(name='CategoryType', example='1'),
      iconUrl?: string(name='IconUrl', example='https://app-streaming-icon-prod-shanghai.oss-cn-shanghai.aliyuncs.com/tenant/1973619010349344/1634523814270_Matlab.png'),
      isAuth?: boolean(name='IsAuth', example='True'),
      usedInSession?: boolean(name='UsedInSession', example='True'),
    }
  ](name='AppModels', description='appModels'),
  nextToken?: string(name='NextToken', example='2NVfhLfgy5b3J5iJyoLQ6x4EULMg1hbhgB9NfnvdK9oj5zwxd17j4TuQkZze3RvhEvBinZYjknujF3Q1M'),
  requestId?: string(name='RequestId', description='Id of the request', example='DB70F8FE-63A3-587B-8560-CEC258E8B944'),
}

model ListPublishedAppInfoResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListPublishedAppInfoResponseBody(name='body'),
}

/**
 * @summary 已上架应用列表
 *
 * @param request ListPublishedAppInfoRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListPublishedAppInfoResponse
 */
async function listPublishedAppInfoWithOptions(request: ListPublishedAppInfoRequest, runtime: Util.RuntimeOptions): ListPublishedAppInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.bizRegionId)) {
    query['BizRegionId'] = request.bizRegionId;
  }
  if (!Util.isUnset(request.categoryId)) {
    query['CategoryId'] = request.categoryId;
  }
  if (!Util.isUnset(request.categoryType)) {
    query['CategoryType'] = request.categoryType;
  }
  if (!Util.isUnset(request.clientId)) {
    query['ClientId'] = request.clientId;
  }
  if (!Util.isUnset(request.clientIp)) {
    query['ClientIp'] = request.clientIp;
  }
  if (!Util.isUnset(request.clientOS)) {
    query['ClientOS'] = request.clientOS;
  }
  if (!Util.isUnset(request.clientVersion)) {
    query['ClientVersion'] = request.clientVersion;
  }
  if (!Util.isUnset(request.endUserId)) {
    query['EndUserId'] = request.endUserId;
  }
  if (!Util.isUnset(request.loginRegionId)) {
    query['LoginRegionId'] = request.loginRegionId;
  }
  if (!Util.isUnset(request.loginToken)) {
    query['LoginToken'] = request.loginToken;
  }
  if (!Util.isUnset(request.orderParam)) {
    query['OrderParam'] = request.orderParam;
  }
  if (!Util.isUnset(request.productType)) {
    query['ProductType'] = request.productType;
  }
  if (!Util.isUnset(request.sessionId)) {
    query['SessionId'] = request.sessionId;
  }
  if (!Util.isUnset(request.sortType)) {
    query['SortType'] = request.sortType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPublishedAppInfo',
    version = '2021-09-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'Anonymous',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 已上架应用列表
 *
 * @param request ListPublishedAppInfoRequest
 * @return ListPublishedAppInfoResponse
 */
async function listPublishedAppInfo(request: ListPublishedAppInfoRequest): ListPublishedAppInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return listPublishedAppInfoWithOptions(request, runtime);
}

model ListRunningAppsRequest {
  bizRegionId?: string(name='BizRegionId', example='cn-hangzhou'),
  clientId?: string(name='ClientId', example='370b56f8-2812-4b6c-bfa6-2560791cad88'),
  clientIp?: string(name='ClientIp', example='22.21.2.32'),
  clientOS?: string(name='ClientOS', example='windows_"Windows 10 Enterprise" 10.0 (Build 18363)'),
  clientVersion?: string(name='ClientVersion', example='0.1.0-R-20220512.175656'),
  endUserId?: string(name='EndUserId', example='test.test'),
  loginRegionId?: string(name='LoginRegionId', example='cn-hangzhou'),
  loginToken?: string(name='LoginToken', example='v1124500957832f30b3e716406562071655aa43b2a723ed2be0837815483d54e025db13ba5469f06f2410d0efc4d302e36'),
  productType?: string(name='ProductType', example='CloudApp'),
  sessionId?: string(name='SessionId', example='a863f4c3-2f1d-4971-8cf7-e2b92ae97764'),
  tenantId?: string(name='TenantId', example='1735953493960828'),
  uuid?: string(name='Uuid', example='470E8C12AB78CE9C3F6627DD0409E51D'),
}

model ListRunningAppsResponseBody = {
  requestId?: string(name='RequestId', description='Id of the request', example='2DC3521C-3820-5EA5-9A9A-00BB7AF4E8E5'),
  runningCloudApps?: [ 
    {
      appId?: string(name='AppId', example='ca-dln05y44ze6esfl8x'),
      appInstanceGroupId?: string(name='AppInstanceGroupId', example='aig-dk8p95irk9xs5xi6a'),
      appInstanceId?: string(name='AppInstanceId', example='ai-gc1gemx6vpa6vlync'),
      appName?: string(name='AppName', example='alihealth-keeper'),
      appVersion?: string(name='AppVersion', example='11.1'),
      appVersionName?: string(name='AppVersionName', example='test1.0'),
      duration?: long(name='Duration', example='87'),
      iconUrl?: string(name='IconUrl', example='https://app-icon-shanghai.oss-cn-shanghai.aliyuncs.com/tenant/187465/18_bf1.jpg'),
      osType?: string(name='OsType', example='Windows'),
      regionId?: string(name='RegionId', example='cn-hangzhou'),
      startTime?: string(name='StartTime', example='1642748400'),
    }
  ](name='RunningCloudApps'),
}

model ListRunningAppsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListRunningAppsResponseBody(name='body'),
}

/**
 * @summary 运行中应用列表
 *
 * @param request ListRunningAppsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListRunningAppsResponse
 */
async function listRunningAppsWithOptions(request: ListRunningAppsRequest, runtime: Util.RuntimeOptions): ListRunningAppsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.bizRegionId)) {
    query['BizRegionId'] = request.bizRegionId;
  }
  if (!Util.isUnset(request.clientId)) {
    query['ClientId'] = request.clientId;
  }
  if (!Util.isUnset(request.clientIp)) {
    query['ClientIp'] = request.clientIp;
  }
  if (!Util.isUnset(request.clientOS)) {
    query['ClientOS'] = request.clientOS;
  }
  if (!Util.isUnset(request.clientVersion)) {
    query['ClientVersion'] = request.clientVersion;
  }
  if (!Util.isUnset(request.endUserId)) {
    query['EndUserId'] = request.endUserId;
  }
  if (!Util.isUnset(request.loginRegionId)) {
    query['LoginRegionId'] = request.loginRegionId;
  }
  if (!Util.isUnset(request.loginToken)) {
    query['LoginToken'] = request.loginToken;
  }
  if (!Util.isUnset(request.productType)) {
    query['ProductType'] = request.productType;
  }
  if (!Util.isUnset(request.sessionId)) {
    query['SessionId'] = request.sessionId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.uuid)) {
    query['Uuid'] = request.uuid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListRunningApps',
    version = '2021-09-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'Anonymous',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 运行中应用列表
 *
 * @param request ListRunningAppsRequest
 * @return ListRunningAppsResponse
 */
async function listRunningApps(request: ListRunningAppsRequest): ListRunningAppsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listRunningAppsWithOptions(request, runtime);
}

model ResetAppResourcesRequest {
  appInstanceGroupId?: string(name='AppInstanceGroupId', description='This parameter is required.', example='aig-9ciijz60n4xsv****'),
  bizRegionId?: string(name='BizRegionId', example='cn-hangzhou'),
  clientId?: string(name='ClientId', description='This parameter is required.', example='f4a0dc8e-1702-4728-9a60-95b27a35****'),
  clientIp?: string(name='ClientIp', example='1.2.3.4'),
  clientOS?: string(name='ClientOS', example='windows_\\\\"Windows 10 Pro\\\\" 10.0 (Build 22631)'),
  clientVersion?: string(name='ClientVersion', example='7.7.0-R-20241217.092056'),
  endUserId?: string(name='EndUserId', example='user01'),
  loginRegionId?: string(name='LoginRegionId', example='cn-hangzhou'),
  loginToken?: string(name='LoginToken', description='This parameter is required.', example='v285fdd7f6d39fa7861981639366085772e150a390a5bb7b43c4e62440d94fc392b945770e1596cebe90085ce0af4d****'),
  productType?: string(name='ProductType', description='This parameter is required.', example='AndroidCloud'),
  resourceIds?: [ string ](name='ResourceIds', description='This parameter is required.'),
  sessionId?: string(name='SessionId', description='This parameter is required.', example='c261a6a1-e242-4f4b-813c-5fe807e49f03'),
  uuid?: string(name='Uuid', example='2943802884B27030B6759F9132B2****'),
}

model ResetAppResourcesResponseBody = {
  code?: string(name='Code', example='InvalidAppInstanceGroup.NotFound'),
  message?: string(name='Message', example='The app instance group is not found.'),
  requestId?: string(name='RequestId', example='1CBAFFAB-B697-4049-A9B1-67E1FC5F****'),
  success?: string(name='Success', example='true'),
}

model ResetAppResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ResetAppResourcesResponseBody(name='body'),
}

/**
 * @summary 重置应用资源
 *
 * @param request ResetAppResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ResetAppResourcesResponse
 */
async function resetAppResourcesWithOptions(request: ResetAppResourcesRequest, runtime: Util.RuntimeOptions): ResetAppResourcesResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.appInstanceGroupId)) {
    body['AppInstanceGroupId'] = request.appInstanceGroupId;
  }
  if (!Util.isUnset(request.bizRegionId)) {
    body['BizRegionId'] = request.bizRegionId;
  }
  if (!Util.isUnset(request.clientId)) {
    body['ClientId'] = request.clientId;
  }
  if (!Util.isUnset(request.clientIp)) {
    body['ClientIp'] = request.clientIp;
  }
  if (!Util.isUnset(request.clientOS)) {
    body['ClientOS'] = request.clientOS;
  }
  if (!Util.isUnset(request.clientVersion)) {
    body['ClientVersion'] = request.clientVersion;
  }
  if (!Util.isUnset(request.endUserId)) {
    body['EndUserId'] = request.endUserId;
  }
  if (!Util.isUnset(request.loginRegionId)) {
    body['LoginRegionId'] = request.loginRegionId;
  }
  if (!Util.isUnset(request.loginToken)) {
    body['LoginToken'] = request.loginToken;
  }
  if (!Util.isUnset(request.productType)) {
    body['ProductType'] = request.productType;
  }
  if (!Util.isUnset(request.resourceIds)) {
    body['ResourceIds'] = request.resourceIds;
  }
  if (!Util.isUnset(request.sessionId)) {
    body['SessionId'] = request.sessionId;
  }
  if (!Util.isUnset(request.uuid)) {
    body['Uuid'] = request.uuid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ResetAppResources',
    version = '2021-09-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'Anonymous',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 重置应用资源
 *
 * @param request ResetAppResourcesRequest
 * @return ResetAppResourcesResponse
 */
async function resetAppResources(request: ResetAppResourcesRequest): ResetAppResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return resetAppResourcesWithOptions(request, runtime);
}

model RestartAppResourcesRequest {
  appInstanceGroupId?: string(name='AppInstanceGroupId', description='This parameter is required.', example='aig-53fvrq1oanz6c****'),
  bizRegionId?: string(name='BizRegionId', example='cn-hangzhou'),
  clientId?: string(name='ClientId', description='This parameter is required.', example='eac19bef-1e45-4190-a03a-4ea74b699ca7'),
  clientIp?: string(name='ClientIp', example='1.2.3.4'),
  clientOS?: string(name='ClientOS', example='windows_\\\\"Windows 10 Enterprise\\\\" 10.0 (Build 14393)'),
  clientVersion?: string(name='ClientVersion', example='7.5.3-RS-20241127.131156'),
  endUserId?: string(name='EndUserId', example='user001'),
  loginRegionId?: string(name='LoginRegionId', example='cn-hangzhou'),
  loginToken?: string(name='LoginToken', description='This parameter is required.', example='v1124500957832f30b3e716406562071655aa43b2a723ed2be0837815483d54e025db13ba5469f06f2410d0efc4d302e36'),
  productType?: string(name='ProductType', description='This parameter is required.', example='AndroidCloud'),
  resourceIds?: [ string ](name='ResourceIds', description='This parameter is required.'),
  sessionId?: string(name='SessionId', description='This parameter is required.', example='c261a6a1-e242-4f4b-813c-5fe807e49f03'),
  uuid?: string(name='Uuid', example='2943802884B27030B6759F9132B2****'),
}

model RestartAppResourcesResponseBody = {
  code?: string(name='Code', example='InvalidAppInstanceGroup.NotFound'),
  message?: string(name='Message', example='The app instance group is not found.'),
  requestId?: string(name='RequestId', example='1CBAFFAB-B697-4049-A9B1-67E1FC5F****'),
  success?: string(name='Success', example='true'),
}

model RestartAppResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RestartAppResourcesResponseBody(name='body'),
}

/**
 * @summary 重启应用资源
 *
 * @param request RestartAppResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return RestartAppResourcesResponse
 */
async function restartAppResourcesWithOptions(request: RestartAppResourcesRequest, runtime: Util.RuntimeOptions): RestartAppResourcesResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.appInstanceGroupId)) {
    body['AppInstanceGroupId'] = request.appInstanceGroupId;
  }
  if (!Util.isUnset(request.bizRegionId)) {
    body['BizRegionId'] = request.bizRegionId;
  }
  if (!Util.isUnset(request.clientId)) {
    body['ClientId'] = request.clientId;
  }
  if (!Util.isUnset(request.clientIp)) {
    body['ClientIp'] = request.clientIp;
  }
  if (!Util.isUnset(request.clientOS)) {
    body['ClientOS'] = request.clientOS;
  }
  if (!Util.isUnset(request.clientVersion)) {
    body['ClientVersion'] = request.clientVersion;
  }
  if (!Util.isUnset(request.endUserId)) {
    body['EndUserId'] = request.endUserId;
  }
  if (!Util.isUnset(request.loginRegionId)) {
    body['LoginRegionId'] = request.loginRegionId;
  }
  if (!Util.isUnset(request.loginToken)) {
    body['LoginToken'] = request.loginToken;
  }
  if (!Util.isUnset(request.productType)) {
    body['ProductType'] = request.productType;
  }
  if (!Util.isUnset(request.resourceIds)) {
    body['ResourceIds'] = request.resourceIds;
  }
  if (!Util.isUnset(request.sessionId)) {
    body['SessionId'] = request.sessionId;
  }
  if (!Util.isUnset(request.uuid)) {
    body['Uuid'] = request.uuid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'RestartAppResources',
    version = '2021-09-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'Anonymous',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 重启应用资源
 *
 * @param request RestartAppResourcesRequest
 * @return RestartAppResourcesResponse
 */
async function restartAppResources(request: RestartAppResourcesRequest): RestartAppResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return restartAppResourcesWithOptions(request, runtime);
}

model StartAppResourcesRequest {
  appInstanceGroupId?: string(name='AppInstanceGroupId', description='This parameter is required.', example='aig-9ciijz60n4xsv****'),
  bizRegionId?: string(name='BizRegionId', example='cn-hangzhou'),
  clientId?: string(name='ClientId', description='This parameter is required.', example='eac19bef-1e45-4190-a03a-4ea74b69****'),
  clientIp?: string(name='ClientIp', example='1.2.3.4'),
  clientOS?: string(name='ClientOS', example='windows_\\\\"Windows 10 Pro\\\\" 10.0 (Build 22631)'),
  clientVersion?: string(name='ClientVersion', example='7.5.1-R-20240903.163046'),
  endUserId?: string(name='EndUserId', example='testUser01'),
  loginRegionId?: string(name='LoginRegionId', example='cn-hangzhou'),
  loginToken?: string(name='LoginToken', description='This parameter is required.', example='v185fdd7f6d39fa7861981639366085772e150a390a5bb7b43c4e62440d94fc392b945770e1596cebe90085ce0af4d****'),
  productType?: string(name='ProductType', description='This parameter is required.', example='AndroidCloud'),
  resourceIds?: [ string ](name='ResourceIds', description='This parameter is required.'),
  sessionId?: string(name='SessionId', description='This parameter is required.', example='a863f4c3-2f1d-4971-8cf7-e2b92ae9****'),
  uuid?: string(name='Uuid', example='2943802884B27030B6759F9132B2****'),
}

model StartAppResourcesResponseBody = {
  code?: string(name='Code', example='InvalidAppInstanceGroup.NotFound'),
  message?: string(name='Message', example='The app instance group is not found.'),
  requestId?: string(name='RequestId', example='1CBAFFAB-B697-4049-A9B1-67E1FC5F****'),
  success?: string(name='Success', example='true'),
}

model StartAppResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StartAppResourcesResponseBody(name='body'),
}

/**
 * @summary 启动应用资源
 *
 * @param request StartAppResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return StartAppResourcesResponse
 */
async function startAppResourcesWithOptions(request: StartAppResourcesRequest, runtime: Util.RuntimeOptions): StartAppResourcesResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.appInstanceGroupId)) {
    body['AppInstanceGroupId'] = request.appInstanceGroupId;
  }
  if (!Util.isUnset(request.bizRegionId)) {
    body['BizRegionId'] = request.bizRegionId;
  }
  if (!Util.isUnset(request.clientId)) {
    body['ClientId'] = request.clientId;
  }
  if (!Util.isUnset(request.clientIp)) {
    body['ClientIp'] = request.clientIp;
  }
  if (!Util.isUnset(request.clientOS)) {
    body['ClientOS'] = request.clientOS;
  }
  if (!Util.isUnset(request.clientVersion)) {
    body['ClientVersion'] = request.clientVersion;
  }
  if (!Util.isUnset(request.endUserId)) {
    body['EndUserId'] = request.endUserId;
  }
  if (!Util.isUnset(request.loginRegionId)) {
    body['LoginRegionId'] = request.loginRegionId;
  }
  if (!Util.isUnset(request.loginToken)) {
    body['LoginToken'] = request.loginToken;
  }
  if (!Util.isUnset(request.productType)) {
    body['ProductType'] = request.productType;
  }
  if (!Util.isUnset(request.resourceIds)) {
    body['ResourceIds'] = request.resourceIds;
  }
  if (!Util.isUnset(request.sessionId)) {
    body['SessionId'] = request.sessionId;
  }
  if (!Util.isUnset(request.uuid)) {
    body['Uuid'] = request.uuid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'StartAppResources',
    version = '2021-09-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'Anonymous',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 启动应用资源
 *
 * @param request StartAppResourcesRequest
 * @return StartAppResourcesResponse
 */
async function startAppResources(request: StartAppResourcesRequest): StartAppResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return startAppResourcesWithOptions(request, runtime);
}

model StopAppRequest {
  aliUid?: long(name='AliUid', example='1924794279035094'),
  apiType?: string(name='ApiType', example='AnonymousUserAPI'),
  appId?: string(name='AppId', example='ca-fxwp4koywsglzvvex'),
  appInstanceGroupId?: string(name='AppInstanceGroupId', example='aig-89ibriac2wudyph38'),
  appInstanceId?: string(name='AppInstanceId', example='ai-d297eyf83g5niwnjl'),
  bizRegionId?: string(name='BizRegionId', example='cn-hangzhou'),
  clientChannel?: string(name='ClientChannel', example='pc'),
  clientId?: string(name='ClientId', example='91b79184-51d0-42ad-8475-78cae95b0aa6'),
  clientIp?: string(name='ClientIp', example='22.21.2.79'),
  clientOS?: string(name='ClientOS', example='windows_"Windows 10 Enterprise" 10.0 (Build 19042)'),
  clientVersion?: string(name='ClientVersion', example='3.1.1-R-20211022.144255'),
  endUserId?: string(name='EndUserId', example='test.test'),
  forceStop?: boolean(name='ForceStop', example='false'),
  idpId?: string(name='IdpId', example='idp-9ie5smicnct2xodn2'),
  loginRegionId?: string(name='LoginRegionId', example='cn-hangzhou'),
  loginToken?: string(name='LoginToken', example='v185fdd7f6d39fa7861981639366085772e150a390a5bb7b43c4e62440d94fc392b945770e1596cebe90085ce0af4d330e'),
  productType?: string(name='ProductType', example='CloudApp'),
  regionId?: string(name='RegionId', example='cn-hangzhou'),
  sessionId?: string(name='SessionId', example='597e869d-ea14-4b83-9490-714f68bfe935'),
  uuid?: string(name='Uuid', example='2943802884B27030B6759F9132B26903'),
  wyId?: string(name='WyId', example='ac3cb49059261898'),
}

model StopAppResponseBody = {
  requestId?: string(name='RequestId', example='83A9075B-C646-59A9-8232-CAE41AF4B9E3'),
}

model StopAppResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StopAppResponseBody(name='body'),
}

/**
 * @summary 停止应用
 *
 * @param request StopAppRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return StopAppResponse
 */
async function stopAppWithOptions(request: StopAppRequest, runtime: Util.RuntimeOptions): StopAppResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.aliUid)) {
    body['AliUid'] = request.aliUid;
  }
  if (!Util.isUnset(request.apiType)) {
    body['ApiType'] = request.apiType;
  }
  if (!Util.isUnset(request.appId)) {
    body['AppId'] = request.appId;
  }
  if (!Util.isUnset(request.appInstanceGroupId)) {
    body['AppInstanceGroupId'] = request.appInstanceGroupId;
  }
  if (!Util.isUnset(request.appInstanceId)) {
    body['AppInstanceId'] = request.appInstanceId;
  }
  if (!Util.isUnset(request.bizRegionId)) {
    body['BizRegionId'] = request.bizRegionId;
  }
  if (!Util.isUnset(request.clientChannel)) {
    body['ClientChannel'] = request.clientChannel;
  }
  if (!Util.isUnset(request.clientId)) {
    body['ClientId'] = request.clientId;
  }
  if (!Util.isUnset(request.clientIp)) {
    body['ClientIp'] = request.clientIp;
  }
  if (!Util.isUnset(request.clientOS)) {
    body['ClientOS'] = request.clientOS;
  }
  if (!Util.isUnset(request.clientVersion)) {
    body['ClientVersion'] = request.clientVersion;
  }
  if (!Util.isUnset(request.endUserId)) {
    body['EndUserId'] = request.endUserId;
  }
  if (!Util.isUnset(request.forceStop)) {
    body['ForceStop'] = request.forceStop;
  }
  if (!Util.isUnset(request.idpId)) {
    body['IdpId'] = request.idpId;
  }
  if (!Util.isUnset(request.loginRegionId)) {
    body['LoginRegionId'] = request.loginRegionId;
  }
  if (!Util.isUnset(request.loginToken)) {
    body['LoginToken'] = request.loginToken;
  }
  if (!Util.isUnset(request.productType)) {
    body['ProductType'] = request.productType;
  }
  if (!Util.isUnset(request.regionId)) {
    body['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.sessionId)) {
    body['SessionId'] = request.sessionId;
  }
  if (!Util.isUnset(request.uuid)) {
    body['Uuid'] = request.uuid;
  }
  if (!Util.isUnset(request.wyId)) {
    body['WyId'] = request.wyId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'StopApp',
    version = '2021-09-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'Anonymous',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 停止应用
 *
 * @param request StopAppRequest
 * @return StopAppResponse
 */
async function stopApp(request: StopAppRequest): StopAppResponse {
  var runtime = new Util.RuntimeOptions{};
  return stopAppWithOptions(request, runtime);
}

model StopAppResourcesRequest {
  appInstanceGroupId?: string(name='AppInstanceGroupId', description='This parameter is required.', example='aig-9ciijz60n4xsv****'),
  bizRegionId?: string(name='BizRegionId', example='cn-hangzhou'),
  clientId?: string(name='ClientId', description='This parameter is required.', example='eac19bef-1e45-4190-a03a-4ea74b699ca7'),
  clientIp?: string(name='ClientIp', example='1.2.3.4'),
  clientOS?: string(name='ClientOS', example='windows_"Windows 10 Enterprise" 10.0 (Build 19042)'),
  clientVersion?: string(name='ClientVersion', example='7.2.0-R-20241008.110000'),
  endUserId?: string(name='EndUserId', example='testUser'),
  loginRegionId?: string(name='LoginRegionId', example='cn-hangzhou'),
  loginToken?: string(name='LoginToken', description='This parameter is required.', example='v12369636c721ba6b3ddb1683341016775c3f63e4d0e78f120f9a0544ed826b7af7daf747c402f0d0730b52f451b70****'),
  productType?: string(name='ProductType', description='This parameter is required.', example='AndroidCloud'),
  resourceIds?: [ string ](name='ResourceIds', description='This parameter is required.'),
  sessionId?: string(name='SessionId', description='This parameter is required.', example='597e869d-ea14-4b83-9490-714f68bfe935'),
  uuid?: string(name='Uuid', example='C50973691A6D2BE23F2CDD73B85B****'),
}

model StopAppResourcesResponseBody = {
  code?: string(name='Code', example='InvalidAppInstanceGroup.NotFound'),
  message?: string(name='Message', example='The app instance group is not found.'),
  requestId?: string(name='RequestId', example='829444D6-9FD3-5C65-A570-065975537647'),
  success?: string(name='Success', example='true'),
}

model StopAppResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StopAppResourcesResponseBody(name='body'),
}

/**
 * @summary 关闭应用资源
 *
 * @param request StopAppResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return StopAppResourcesResponse
 */
async function stopAppResourcesWithOptions(request: StopAppResourcesRequest, runtime: Util.RuntimeOptions): StopAppResourcesResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.appInstanceGroupId)) {
    body['AppInstanceGroupId'] = request.appInstanceGroupId;
  }
  if (!Util.isUnset(request.bizRegionId)) {
    body['BizRegionId'] = request.bizRegionId;
  }
  if (!Util.isUnset(request.clientId)) {
    body['ClientId'] = request.clientId;
  }
  if (!Util.isUnset(request.clientIp)) {
    body['ClientIp'] = request.clientIp;
  }
  if (!Util.isUnset(request.clientOS)) {
    body['ClientOS'] = request.clientOS;
  }
  if (!Util.isUnset(request.clientVersion)) {
    body['ClientVersion'] = request.clientVersion;
  }
  if (!Util.isUnset(request.endUserId)) {
    body['EndUserId'] = request.endUserId;
  }
  if (!Util.isUnset(request.loginRegionId)) {
    body['LoginRegionId'] = request.loginRegionId;
  }
  if (!Util.isUnset(request.loginToken)) {
    body['LoginToken'] = request.loginToken;
  }
  if (!Util.isUnset(request.productType)) {
    body['ProductType'] = request.productType;
  }
  if (!Util.isUnset(request.resourceIds)) {
    body['ResourceIds'] = request.resourceIds;
  }
  if (!Util.isUnset(request.sessionId)) {
    body['SessionId'] = request.sessionId;
  }
  if (!Util.isUnset(request.uuid)) {
    body['Uuid'] = request.uuid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'StopAppResources',
    version = '2021-09-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'Anonymous',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 关闭应用资源
 *
 * @param request StopAppResourcesRequest
 * @return StopAppResourcesResponse
 */
async function stopAppResources(request: StopAppResourcesRequest): StopAppResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return stopAppResourcesWithOptions(request, runtime);
}

model UnbindRequest {
  appId?: string(name='AppId', example='ca-fxwp4koxs8hopi94e'),
  appInstanceGroupId?: string(name='AppInstanceGroupId', description='This parameter is required.', example='aig-e1l4kqqykxt4uzdx9'),
  appInstanceId?: string(name='AppInstanceId'),
  clientId?: string(name='ClientId', example='eac19bef-1e45-4190-a03a-4ea74b699ca7'),
  clientIp?: string(name='ClientIp', example='139.129.223.122'),
  clientOS?: string(name='ClientOS', example='windows_\\\\"Windows 10 Pro\\\\" 10.0 (Build 19041)'),
  clientVersion?: string(name='ClientVersion', example='2.0.1-D-20220303.171122'),
  endUserId?: string(name='EndUserId', example='test.test'),
  loginRegionId?: string(name='LoginRegionId', example='cn-shanghai'),
  loginToken?: string(name='LoginToken', description='This parameter is required.', example='v1e9c8e83d83ea11270871640059145702bde8c5be8c6b9a854ffb6a43bd2673c19a5551c83800724e024f488dbfb0b247'),
  productType?: string(name='ProductType', description='This parameter is required.', example='CloudApp'),
  sessionId?: string(name='SessionId', description='This parameter is required.', example='11040139-4fb4-4b35-9b44-6c07c746a43e'),
  tenantId?: long(name='TenantId', example='1569416393841402'),
}

model UnbindResponseBody = {
  requestId?: string(name='RequestId', description='Id of the request', example='6EBD4046-2202-5FBD-8595-4B631F0C484B'),
}

model UnbindResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UnbindResponseBody(name='body'),
}

/**
 * @summary 解绑实例
 *
 * @param request UnbindRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UnbindResponse
 */
async function unbindWithOptions(request: UnbindRequest, runtime: Util.RuntimeOptions): UnbindResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.appId)) {
    body['AppId'] = request.appId;
  }
  if (!Util.isUnset(request.appInstanceGroupId)) {
    body['AppInstanceGroupId'] = request.appInstanceGroupId;
  }
  if (!Util.isUnset(request.appInstanceId)) {
    body['AppInstanceId'] = request.appInstanceId;
  }
  if (!Util.isUnset(request.clientId)) {
    body['ClientId'] = request.clientId;
  }
  if (!Util.isUnset(request.clientIp)) {
    body['ClientIp'] = request.clientIp;
  }
  if (!Util.isUnset(request.clientOS)) {
    body['ClientOS'] = request.clientOS;
  }
  if (!Util.isUnset(request.clientVersion)) {
    body['ClientVersion'] = request.clientVersion;
  }
  if (!Util.isUnset(request.endUserId)) {
    body['EndUserId'] = request.endUserId;
  }
  if (!Util.isUnset(request.loginRegionId)) {
    body['LoginRegionId'] = request.loginRegionId;
  }
  if (!Util.isUnset(request.loginToken)) {
    body['LoginToken'] = request.loginToken;
  }
  if (!Util.isUnset(request.productType)) {
    body['ProductType'] = request.productType;
  }
  if (!Util.isUnset(request.sessionId)) {
    body['SessionId'] = request.sessionId;
  }
  if (!Util.isUnset(request.tenantId)) {
    body['TenantId'] = request.tenantId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'Unbind',
    version = '2021-09-03',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'Anonymous',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 解绑实例
 *
 * @param request UnbindRequest
 * @return UnbindResponse
 */
async function unbind(request: UnbindRequest): UnbindResponse {
  var runtime = new Util.RuntimeOptions{};
  return unbindWithOptions(request, runtime);
}

